package ma.ac.onousc.gestionfi.budget.model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Set;

/**
 * The persistent class for the programme_emploi database table.
 * 
 */
@Entity
@Table(name = "programme_emploi")
@NamedQueries({
		@NamedQuery(name = "ProgrammeEmploi.findAll", query = "select o from ProgrammeEmploi o"),
		@NamedQuery(name = "ProgrammeEmploi.findAnneeMaxFonc", query = "select MAX(o.anneeProgrammeEmploi) from ProgrammeEmploi o where o.typeBudget.intituleTypeBudget = 'FONCTIONNEMENT'"),
		@NamedQuery(name = "ProgrammeEmploi.findAllFonc", query = "select o from ProgrammeEmploi o where o.typeBudget.intituleTypeBudget = 'FONCTIONNEMENT'"),
		@NamedQuery(name = "ProgrammeEmploi.findAnneeMax", query = "select max(o.anneeProgrammeEmploi) from ProgrammeEmploi o"),
		@NamedQuery(name = "ProgrammeEmploi.findAnnee", query = "select an.anneeProgrammeEmploi from  ProgrammeEmploi an"),
		@NamedQuery(name = "ProgrammeEmploi.findByAnneeAndTypeBudget", query = "select o from ProgrammeEmploi o where o.anneeProgrammeEmploi = :ANNEE and o.typeBudget = :TYPE_BUDGET"),
		@NamedQuery(name = "ProgrammeEmploi.findById", query = "select o from ProgrammeEmploi o where o.idProgrammeEmploi = :ID"),
		@NamedQuery(name = "ProgrammeEmploi.isCloture", query = "select o from ProgrammeEmploi o where o.idProgrammeEmploi = :PROGRAMME_EMPLOI")

})
public class ProgrammeEmploi implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "ID_PROGRAMME_EMPLOI")
	private int idProgrammeEmploi;

	@Column(name = "ANNEE_PROGRAMME_EMPLOI")
	private int anneeProgrammeEmploi;

	// bi-directional many-to-one association to TypeBudget
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "ID_TYPE_BUDGET")
	private TypeBudget typeBudget;

	// bi-directional many-to-one association to RubriqueBudgetaire
	@OneToMany(mappedBy = "programmeEmploi")
	private Set<RubriqueBudgetaire> rubriqueBudgetaires;

	// bi-directional many-to-one association to Soumettre
	@OneToMany(mappedBy = "programmeEmploi")
	private Set<Soumettre> soumettres;

	@Column(name = "CLOTURER_PROGRAMME_EMPLOI")
	private boolean cloturerProgrammeEmploi;

	public ProgrammeEmploi() {
	}

	public ProgrammeEmploi(int annee, TypeBudget typeBudget) {
		this.anneeProgrammeEmploi = annee;
		this.typeBudget = typeBudget;
	}

	public int getIdProgrammeEmploi() {
		return this.idProgrammeEmploi;
	}

	public void setIdProgrammeEmploi(int idProgrammeEmploi) {
		this.idProgrammeEmploi = idProgrammeEmploi;
	}

	public int getAnneeProgrammeEmploi() {
		return this.anneeProgrammeEmploi;
	}

	public void setAnneeProgrammeEmploi(int anneeProgrammeEmploi) {
		this.anneeProgrammeEmploi = anneeProgrammeEmploi;
	}

	public TypeBudget getTypeBudget() {
		return this.typeBudget;
	}

	public void setTypeBudget(TypeBudget typeBudget) {
		this.typeBudget = typeBudget;
	}

	public Set<RubriqueBudgetaire> getRubriqueBudgetaires() {
		return this.rubriqueBudgetaires;
	}

	public void setRubriqueBudgetaires(
			Set<RubriqueBudgetaire> rubriqueBudgetaires) {
		this.rubriqueBudgetaires = rubriqueBudgetaires;
	}

	public Set<Soumettre> getSoumettres() {
		return this.soumettres;
	}

	public void setSoumettres(Set<Soumettre> soumettres) {
		this.soumettres = soumettres;
	}

	public boolean isCloturerProgrammeEmploi() {
		return cloturerProgrammeEmploi;
	}

	public void setCloturerProgrammeEmploi(boolean cloturerProgrammeEmploi) {
		this.cloturerProgrammeEmploi = cloturerProgrammeEmploi;
	}

}